package com.borrowed.book.book.mapper;

import com.borrowed.book.book.domain.InitialBookPayDto;
import com.borrowed.book.book.domain.SBook;
import com.borrowed.book.book.domain.SelectBookInDto;
import com.borrowed.book.book.domain.SelectBookOutDto;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface SBookMapper {
    int insert(SBook record);

    int insertSelective(SBook record);

    //插入书籍标签关联表
    int insertBookLabelRel(Map map);
    //更新书籍内容
    int update(SBook record);
    //删除书籍标签关联表
    int deleteBookLabelRel(Long id);
    //批量删除书籍标签关联关系
    void deleteBookLabelRels(Map map);
    //图书批量删除
    void deleteBookByIds(Map map);
    //图书一览
    List<SelectBookOutDto> selectBookList(Map map);
    //根据id查询图书详细信息
    SelectBookOutDto selectBookById(Long id);
    //图书库存减1
    void reduceBookRemaining(Long bookId);
    //图书库存加1
    void increaseBookRemaining(Long bookId);
    //下订单页面初始化
    List<InitialBookPayDto>  selectBookListForPay(Map map);
    //根据isbn查询书籍信息
    SBook selectBookByIsbn(String isbn);
    //图书数量、库存增加1
    void increaseBookNumber(Long bookId);
    //查询图书租借价格总和
    BigDecimal selectBorrowRentMoney(Map map);
}